import logging
from datetime import datetime
from src import ConsoleHandler, FileHandler

# 创建 logger
label_logger = logging.getLogger()
label_logger.setLevel(logging.INFO)

# 控制台 handler
console_handler = ConsoleHandler()
label_logger.addHandler(console_handler)

# 生成带日期的日志文件名
date_suffix = datetime.now().strftime("%Y%m%d")
log_filename = f"label_log_{date_suffix}"

# 每天生成一个新的日志文件
file_handler = FileHandler(f"label/logs/{log_filename}.log", when="midnight", interval=1, backupCount=7, encoding="utf-8")
label_logger.addHandler(file_handler)
